/*
 * Copyright (C) 2011 Everybody all the Time
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.everybodyallthetime.android.example.colorpickeractivity;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.everybodyallthetime.android.dialog.colorpicker.ColorPickerDialog;

public class SampleActivity extends Activity {


    SharedPreferences mSharedPreferences;

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ((Button)findViewById(R.id.color_button)).setOnClickListener(new View.OnClickListener(){


            public void onClick(View view) {

                ColorPickerDialog dialog = new ColorPickerDialog(SampleActivity.this, colorChanged, 0);
                dialog.show();

            }
        });
    }


    /**
     * handler for color changed
     */
    ColorPickerDialog.OnColorChangedListener colorChanged = new ColorPickerDialog.OnColorChangedListener() {

        public void colorChanged( int color) {
             ((TextView)findViewById(R.id.hello_text)).setTextColor(color);
        }
    };

}
